home *** CD-ROM | disk | FTP | other *** search
/ Plug-In Power Pack for Netscape Communicator / Plug-In Power Pack for Netscape Communicator.iso / plugins / dataviews / dvdraw / examples / testwin / testdlg.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  1997-05-19  |  2.4 KB  |  105 lines

  1. // TestDlg.cpp : implementation file
  2. //
  3.  
  4. #include "stdafx.h"
  5. #include "TestDlg.h"
  6. #include "TestChildWnd.h"
  7.  
  8. #ifdef _DEBUG
  9. #define new DEBUG_NEW
  10. #undef THIS_FILE
  11. static char THIS_FILE[] = __FILE__;
  12. #endif
  13.  
  14. /////////////////////////////////////////////////////////////////////////////
  15. // CTestDlg dialog
  16.  
  17.  
  18. CTestDlg::CTestDlg(VIEW view, RECTANGLE *wvp, char *clut, CWnd* pParent /*=NULL*/)
  19.     : CDialog(CTestDlg::IDD, pParent), m_View(view), m_pWvpRect(wvp),
  20.   m_pszClut(clut), m_pTestChildWnd(0)
  21. {
  22.     //{{AFX_DATA_INIT(CTestDlg)
  23.     //}}AFX_DATA_INIT
  24. }
  25.  
  26.  
  27. CTestDlg::~CTestDlg()
  28. {
  29.   if(m_pTestChildWnd)
  30.     delete m_pTestChildWnd;
  31. }
  32.  
  33. void CTestDlg::DoDataExchange(CDataExchange* pDX)
  34. {
  35.     CDialog::DoDataExchange(pDX);
  36.     //{{AFX_DATA_MAP(CTestDlg)
  37.     DDX_Control(pDX, IDPAUSE, m_ContPause);
  38.     DDX_Control(pDX, IDC_SPEED, m_UpdRateSlider);
  39.     //}}AFX_DATA_MAP
  40. }
  41.  
  42.  
  43. BEGIN_MESSAGE_MAP(CTestDlg, CDialog)
  44.     //{{AFX_MSG_MAP(CTestDlg)
  45.     ON_BN_CLICKED(IDGO, OnGo)
  46.     ON_BN_CLICKED(IDSTOP, OnStop)
  47.     ON_BN_CLICKED(IDPAUSE, OnPause)
  48.     ON_WM_VSCROLL()
  49.     ON_WM_CANCELMODE()
  50.   ON_NOTIFY(NM_CLICK, IDC_SPEED, OnSliderClick )
  51.     //}}AFX_MSG_MAP
  52. END_MESSAGE_MAP()
  53.  
  54. /////////////////////////////////////////////////////////////////////////////
  55. // CTestDlg message handlers
  56.  
  57.  
  58. /////////////////////////////////////////////////////////////////////////////
  59. // 
  60. BOOL CTestDlg::OnInitDialog() 
  61. {
  62.     CDialog::OnInitDialog();
  63.         
  64.     m_pTestChildWnd = new CTestChildWnd(IDC_RUNAREA,m_View,m_pszClut,this);
  65.     m_pTestChildWnd->Create(IDD_TESTWINDOW,this);
  66.  
  67.   int nRates = m_pTestChildWnd->GetNumUpdateRates();
  68.  
  69.   m_UpdRateSlider.SetRange(0, nRates);
  70.   m_UpdRateSlider.SetPos(m_pTestChildWnd->GetDefaultRate());
  71.  
  72.     return TRUE;  // return TRUE unless you set the focus to a control
  73.                   // EXCEPTION: OCX Property Pages should return FALSE
  74. }
  75.  
  76.  
  77. /////////////////////////////////////////////////////////////////////////////
  78. // 
  79. void CTestDlg::OnGo() 
  80. {
  81.   m_pTestChildWnd->StartTest();
  82. }
  83.  
  84. void CTestDlg::OnStop() 
  85. {
  86.   m_pTestChildWnd->StopTest();
  87. }
  88.  
  89. void CTestDlg::OnPause() 
  90. {
  91.   m_pTestChildWnd->PauseTest();
  92.   if(m_pTestChildWnd->IsPaused())
  93.     m_ContPause.SetWindowText("Cont");
  94.   else
  95.     m_ContPause.SetWindowText("Pause");
  96. }
  97.  
  98. void CTestDlg::OnSliderClick(NMHDR * pNotifyStruct, LRESULT * pResult) 
  99. {
  100.     m_pTestChildWnd->SetUpdateRate(m_UpdRateSlider.GetPos());
  101.   *pResult = 0;
  102. }
  103.  
  104.  
  105.